package com.cliff.joinus.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

import com.actionbarsherlock.app.SherlockActivity;
import com.androidquery.AQuery;
import com.cliff.joinus.MainApplication;
import com.cliff.joinus.R;

public class WelcomeActivity extends SherlockActivity implements OnClickListener {
	
	protected AQuery aq = null;
	protected String TAG = "WelcomeActivity";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        
        aq = new AQuery(this);
        
//        aq.id(R.id.progressBarIndication).invisible();

		Animation anim = new AlphaAnimation(0.0f, 1.0f);
		anim.setDuration(1000); //You can manage the time of the blink with this parameter
		anim.setStartOffset(1000);
		anim.setRepeatMode(Animation.REVERSE);
		anim.setRepeatCount(Animation.INFINITE);

		aq.id(R.id.textViewHint).text(R.string.hint_click_to_continue);
		aq.id(R.id.textViewHint).getTextView().startAnimation(anim);
		
		aq.id(R.id.textViewHint).clicked(this);
		aq.id(R.id.relativeLayoutWelcome).clicked(this);
		
		((MainApplication)getApplication()).init();
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub		
		super.onDestroy();
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		finish();
		startActivity(new Intent(this, MainActivity.class));
//		Toast.makeText(this, "Clicked", Toast.LENGTH_SHORT).show();
	}
	
}
